/**  
 * @title: PropertiesUtils.java
 * @package com.ucan.utils
 * @description: TODO
 * @author yangzhiwei
 */
package com.ds.api.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

/**
 * @className: PropertiesUtils
 * @description: 读取配置文件
 * @author yangzhiwei
 */
public class PropertiesUtils {

    /**
     * 
     * @description: 获取配置文件
     * @param fileName
     * @param key
     * @return
     * @author yangzhiwei
     * @date 2017-5-18
     */
    public static String getPropertiesByKey(String fileName, String key) {
        Properties prop = new Properties();
        String value = "";
        try {
            InputStream in = PropertiesUtils.class.getClassLoader().getResourceAsStream(fileName);

            prop.load(in);
            value = prop.getProperty(key);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        return value;
    }
}
